#include <iostream>

using namespace std;

int main()
{
    int N;
    int A;
    A=3600;
    cin >>N;
    cout <<N%A;
    return 0;
}
